<?php

class UsersController extends AppController {
    var $name = 'Users';
    var $scaffold;
    function login(){}
    function logout(){
        $this->Session->del('Permissions');
        $this->redirect($this->Auth->logout());
    }
}



function profile() {
		
	$id=$this->Auth->user('id');
		
	
	if (!$id && empty($this->data)) {
			$this->Session->setFlash('Invalid User');
			$this->redirect('/', null, true);
		}
		if (!empty($this->data)) {
			//$this->cleanUpFields();
			if ($this->User->save($this->data)) {
				$this->Session->setFlash('The User has been saved');
				$this->redirect('/', null, true);
			} else {
				$this->Session->setFlash('The User could not be saved. Please, try again.');
			}
		}
		if (empty($this->data)) {
			$this->data = $this->User->read(null, $id);
		}
		
	}  
	



?>
